@import '../style/theme/color';
@import '../style/core/_font';
@import '../style/core/animation';

:host {
  padding-right: 20px;
  display: block;
  line-height: 18px;
}

.devui-radio {
  &.disabled {
    cursor: not-allowed;

    .devui-radio-label {
      color: $devui-disabled-text;
    }
  }

  font-size: $devui-font-size;
  line-height: 1.5;
  font-weight: normal;
  cursor: pointer;
  color: $devui-text;
  margin: 0 auto;

  svg {
    .devui-outer {
      stroke: $devui-line;
      fill: transparent;

      &.disabled {
        stroke: $devui-disabled-line;
        fill: $devui-disabled-bg;
      }
    }

    .devui-inner {
      fill: $devui-icon-fill-active;
    }
  }

  &:hover:not(.disabled) {
    svg .devui-outer {
      stroke: $devui-form-control-line-active;
    }

    .devui-radio-label {
      color: $devui-primary-hover;
    }
  }

  &:active:not(.disabled),
  &:focus:not(.disabled) {
    svg .devui-outer {
      stroke: $devui-form-control-line-active;
    }
  }

  &.active {
    svg {
      .devui-outer {
        opacity: 1;
        stroke: $devui-form-control-line-active;
        transition: stroke 50ms $devui-animation-ease-in-out;

        &.disabled {
          stroke: $devui-icon-fill-active-disabled;
          fill: transparent;
        }
      }

      .devui-inner {
        opacity: 1;

        &.disabled {
          fill: $devui-icon-fill-active-disabled;
        }

        transform: scale(1);
        transition: transform $devui-animation-duration-base $devui-animation-ease-in-out, opacity $devui-animation-duration-base $devui-animation-ease-in-out;
      }
    }

    &:not(.disabled) {
      &:active,
      &:focus,
      &:hover {
        .devui-radio-material {
          svg {
            .devui-outer {
              stroke: $devui-form-control-line-active-hover;
            }

            .devui-inner {
              fill: $devui-icon-fill-active-hover;
            }
          }
        }
      }
    }
  }

  .devui-outer {
    opacity: 1;
    transition: stroke 50ms $devui-animation-ease-in-out;
  }

  .devui-inner {
    opacity: 0;
    transform: scale(0);
    transform-origin: 50% 50%;
    transition: transform $devui-animation-duration-base $devui-animation-ease-in-out, opacity $devui-animation-duration-base $devui-animation-ease-in-out;
  }

  .devui-radio-material {
    vertical-align: middle;
    position: relative;
    display: inline-block;
    overflow: hidden;
    height: 16px;
    width: 16px;
    user-select: none;
    transform: translateY(-1px);
  }

  .devui-radio-label {
    color: $devui-text;
    margin-left: 8px;
    font-size: $devui-font-size;
    transition: color $devui-animation-duration-slow $devui-animation-ease-in-out;
  }

  .devui-radio-input {
    opacity: 0;
    z-index: -1;
    width: 0;
    height: 0;
    display: none;
    overflow: hidden;
    pointer-events: none;
  }
}
